<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      >

    <ui:composition template="/WEB-INF/layout/layout.xhtml">
        <ui:define name="title">Články podle kategorií</ui:define>
        <ui:define name="nadpis">Články podle kategorií</ui:define>
                            
        <ui:define name="obsah">
            <!-- Clanky podle kategorie -->
            Kategorie: 
            <h:form>
                <h:commandButton value="Software" action="#{ClankyBean.listClankyByKategorie(1,facesContext.viewRoot.viewId)}"/>
                <h:commandButton value="Hardware" action="#{ClankyBean.listClankyByKategorie(2,facesContext.viewRoot.viewId)}"/>
                <h:commandButton value="Hry" action="#{ClankyBean.listClankyByKategorie(3,facesContext.viewRoot.viewId)}"/>
                <h:commandButton value="Site" action="#{ClankyBean.listClankyByKategorie(4,facesContext.viewRoot.viewId)}"/>
            </h:form>
            <br />

            
            <h:form>
             <p:dataGrid var="clanek" value="#{ClankyBean.clanky}" columns="1"  
                rows="3" paginator="true" effect="true"  
                paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}"  
                rowsPerPageTemplate="1,3,10">  

                <p:column>  
                    <p:panel header="#{clanek.nazev}" style="text-align:center">  
                        <h:panelGrid columns="1" style="width:100%">                              
                            <h:outputText value="#{clanek.text.substring(0,clanek.delka>100?100:clanek.delka)}..." /> <br />
                            <span class="clanekDetaily">Libi: ${clanek.libi} x Nelibi: ${clanek.nelibi}, Navstevnost: ${clanek.navstevnost}</span>
                            
                                <h:commandButton action="#{ClankyBean.showClanek(clanek.id)}" value="Zobrazit clanek - #{clanek.id}"/>
                            
                        </h:panelGrid>  
                    </p:panel>  
                </p:column>  

            </p:dataGrid>  
            </h:form>
       
        </ui:define>

        <ui:define name="menu">
            <ui:include src="/WEB-INF/jspf/menu.xhtml" />
        </ui:define>

    </ui:composition>

</html>

